﻿using eslib.py;
using System;

namespace test
{
    internal class PyTest1
    {


        public void fuck(string who)
        {
            Console.WriteLine($"{who}被fuck了");
        }




        string code = @"
class Test:
    i=0

    #__init__为构造函数
    def __init__(this,i):
        this.i=i;
        
    def setI(this,i):
        this.i=i

    def getI(this):
        return this.i

    def test(this):
        print(""py test() call."")

t=Test(4569)
t.test()

#调用C#对象
so.fuck(""charme"")
";

        internal void test()
        {
            PyEngine py = new PyEngine();

            //绑定对象
            var so = new PyTest1();
            py.AddBindObject(nameof(so), so);

            //运行源码或预编译对象
            py.Exec(code).Wait();
        }
    }
}